﻿using System.Collections.Generic;
using System.Collections.ObjectModel;

namespace DomainExample.DomainModel.ContactModel
{
    /// <summary>
    /// Type Safe Enumeration for Contact Direction Type
    /// </summary>
    public sealed class DirectionType
    {
        private readonly string _name;

        private DirectionType(string name)
        {
            _name = name;
        }

        public override string ToString()
        {
            return _name;
        }

        private const string InboundString = "Inbound";
        private const string OutboundString = "Outbound";

        public static readonly ReadOnlyDictionary<string, DirectionType> Types = new ReadOnlyDictionary<string,DirectionType>(
            new Dictionary<string, DirectionType>
        {
            { InboundString, new DirectionType(InboundString) },
            { OutboundString, new DirectionType(OutboundString) }
        });

        public static readonly DirectionType Inbound = Types[InboundString];
        public static readonly DirectionType Outbound = Types[OutboundString];
    }
}
